﻿@{
    ViewBag.Title = "promotionList";
}

<div id="cphMain_ctl00_ContentPane" class="center">
    <div id="Breadcrumb" class="Breadcrumb">
        <ul>
            <li class="first">
                <a href='javascript:;' onclick="javascript:loadAction('Index2','Main')">Trang chủ
                </a>
            </li>
            <li>
                <a href='javascript:;' onclick="javascript:loadAction('personal','Account')">Tài khoản của tôi
                </a>
            </li>
            <li>
                <span>Danh sách khuyến mãi</span>
            </li>
        </ul>
    </div>

    <div class="Account-Module DefaultModule">

        <div class="Block DefaultModule">


            <div id="CartHeader" class="Block Moveable Panel">
                <h2>Danh sách khuyến mãi
                </h2>
            </div>

            <div id="CartContainer" class="Block Moveable Panel">

                <div class="BlockContent">
                    @if (Model != null)
                    {                
                        <div class="Clear">
                            <div class="FloatRight">
                                <a href="javascript:;" onclick="javascrip:loadAction('PromotionDetail','Admin')"
                                    class="myBtn1">Thêm khuyến mãi mới</a>
                            </div>
                        </div>

                        <div class="Clear">
                        </div>

                        <div>
                            <div>

                                <table class="CartContents" cellspacing="0" rules="rows" border="1"
                                    id="cphMain_ctl00_ctl01_ctl00_grvList" style="width: 100%; border-collapse: collapse;">
                                    <tbody>
                                        <tr class="even-row">
                                            <th scope="col" style="text-align: left">Tên khuyến mãi
                                            </th>
                                            <th scope="col" style="text-align: left"> Giảm giá
                                            </th>

                                            <th scope="col" style="text-align: left">Ngày bắt đầu
                                            </th>
                                            <th scope="col" style="text-align: left">Ngày kết thúc
                                            </th>
                                            <th scope="col">&nbsp;</th>
                                        </tr>
                                        @{var rowCount = 0; string cssRowClass = "";}
                                        @foreach (var promo in Model)
                                        {
                                            if (++rowCount % 2 == 1) { cssRowClass = "old-row"; }
                                            else { cssRowClass = "even-row"; }
                                            <tr class="@cssRowClass">
                                                <td>
                                                    <a href="javascript:;" onclick="javascript:loadActionData('PromotionDetail','Admin','promoID=@promo.ID')">
                                                        <strong>@promo.title</strong></a>
                                                    <br>
                                                </td>
                                                <td>
                                                    <span>@promo.rate %</span>
                                                </td>
                                                <td style="width: 100px;">
                                                    <span>@promo.start_date</span>
                                                </td>
                                                <td style="width: 100px;">                                                    
                                                    <span>@promo.end_date</span>
                                                </td>
                                                <td style="width: 1px;">
                                                    <a href="javascript:;" onclick="javascript:deletePromotion(@promo.ID)" class="myBtn1">Xóa</a>
                                                </td>
                                            </tr>
                                        }
                                    </tbody>
                                </table>
                            </div>
                        </div>                                    
                    }
                </div>
            </div>
        </div>
    </div>
</div>
<input type="hidden" value="@ViewBag.error" id="txtError"/>
    <script type="text/javascript">
        var error = $("#txtError").val();
        if (error.length > 0) {
            alert(error);
        }
    </script>
